package com.lin.manager.common.convert;

import com.lin.manager.common.utils.DateTimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.convert.converter.Converter;

import java.util.Date;

@Slf4j
public class StrToDateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String str) {
        Date date = null;
        try {
            //通过自定义转换器转换字符为日期类型
            date = DateTimeUtil.convertStrToDate(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return date;
    }
}